/*
 * ColConcrete.h - Grupo 5 - Prog. Avanzada 2011
 *
 *  Javier Dominguez - 4.901.161-6
 *  Marcelo Parada - 1.977.094-9
 *  Rodrigo Ruiz - 4.481.611-2
 *  Maximiliano Silvera - 4.106.938-6
 */

#ifndef COLCONCRETE_H_
#define COLCONCRETE_H_

#include <string>
#include "ConcreteIterator.h"
#include "../collections/List.h"
#include "../collections/ICollection.h"

using namespace std;

template <class Type>
class ColConcrete
{
private:
	ICollection *col;

public:
	ColConcrete();

	void add(Type element);

	void remove(Type element);

	bool member(Type element);

	bool isEmpty();

	ConcreteIterator<Type> *getIterator();

	int size();

	string toString();

	bool same(ColConcrete<Type>* colConcrete);

	virtual ~ColConcrete();
};

template<typename Type>
inline ColConcrete<Type>::ColConcrete()
{
	col = new List();
}

template<typename Type>
inline void ColConcrete<Type>::add(Type element)
{
	col->add(element);
}

template<typename Type>
inline void ColConcrete<Type>::remove(Type element)
{
	col->remove(element);
}

template<typename Type>
inline bool ColConcrete<Type>::member(Type element)
{
	return col->member(element);
}

template<typename Type>
inline bool ColConcrete<Type>::isEmpty()
{
	return col->isEmpty();
}

template<typename Type>
inline ConcreteIterator<Type> *ColConcrete<Type>::getIterator()
{
	return new ConcreteIterator<Type>(col->getIterator());
}

template<typename Type>
inline int ColConcrete<Type>::size()
{
	return col->size();
}

template<typename Type>
inline string ColConcrete<Type>::toString()
{
	return col->toString();
}

template<typename Type>
inline bool ColConcrete<Type>::same(ColConcrete<Type> *colConcrete)
{
	return same(colConcrete->col);
}

template<typename Type>
inline ColConcrete<Type>::~ColConcrete()
{
	delete col;
}

#endif /* COLCONCRETE_H_ */
